<?php

namespace App\Http\Controllers;

use App\Models\Feedback;
use Illuminate\Http\Request;

class FeedbackController extends Controller
{
    function new () {
        $userId = request()->input('user_id', 0);
        $context = request()->input('context', "");
        if ($context == "") {
            return response()->json(
                [
                    'recode' => 0,
                    'msg' => '反馈内容为空',
                ]
            );
        }

        $feedbackInfo = new Feedback;
        $feedbackInfo->user_id = $userId;
        $feedbackInfo->context = $context;

        $feedbackInfo->save();
        return response()->json(
            [
                'recode' => 1,
                'msg' => '反馈成功',
            ]
        );

    }
}
